﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AppScan
{
    public class CreateExportContext
    {
        public List<String> fields = new List<String>();

        public bool xml = false;
        public bool csv = false;
        public bool pdf = false;
        public bool html = false;
        public bool executive = false;

        public string savepath = string.Empty;

        //public string[] fields = {string.Empty};
        //public string[] Field 
        //{
        //    get { return fields; }    
        //}
        public string[] hosts = { string.Empty };
        public string[] Host
        {
            get { return hosts; }
        }

        public bool selecthosts { get; set; }

        public bool installedpackages_scan { get; set; }
        public bool qfe_scan { get; set; }
        public bool misc_scan { get; set; }
        public bool reg { get; set; }
        public bool g2g { get; set; }

        public string SelectHosts
        {
            get
            {
                if (!selecthosts)
                    return "All hosts";
                else
                {
                    StringBuilder builder = new StringBuilder();
                    StringBuilderExtensions2.AppendDelim2(builder, "Selected Hosts", " ");
                    return builder.ToString();
                }
                
            }
        }
    }

    // If I'd targeted C# 3.0, this could be real extension methods.
    static class StringBuilderExtensions2
    {
        public static void AppendDelim2(StringBuilder builder, string text, string delim = ", ")
        {
            if (builder.Length != 0)
                builder.Append(delim);
            builder.Append(text);
        }
    }
}
